package com.central.common.feign;

import com.central.common.constant.ServiceNameConstants;
import com.central.common.model.Result;
import com.central.common.model.TaskDefinition;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author td
 */
@FeignClient(name = ServiceNameConstants.SCHE_MANAGE_SERVICE, decode404 = true)
public interface SchedulerService {

    /**
     * 作业任务发布至调度中心
     *
     * @param taskDefinition
     * @return
     */
    @PostMapping("/task/pv/release")
    Result release(TaskDefinition taskDefinition);
    /**
     * 临时执行作业
     *
     * @param taskDefinition
     * @return
     */
    @PostMapping("/task/pv/tmpRunTask")
    Result tmpRunTask(TaskDefinition taskDefinition);

    /**
     * 查询作业版本是否已发布
     * @param taskDefinedLogId
     * @return
     */
    @GetMapping("/task/pv/taskIsRelease")
    Long taskIsRelease(@RequestParam("taskDefinedId") Long taskDefinedId,@RequestParam("taskDefinedLogId") Long taskDefinedLogId);
}
